﻿/* 
 * 内拉 NPC (9020002)
 */

var status;
var random = java.lang.Math.floor(Math.random() * 9 + 1);

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 0 && status == 0) {
        cm.dispose();
        return;
    } else {
        if (mode == 1) {
            status++;
        } else {
            status--;
        }
        var mapId = cm.getMapId();
        if (mapId == 910340000) {
            cm.warp(910340700, 0);
            cm.removeAll(4001007);
            cm.removeAll(4001008);
            cm.dispose();
        } else {
            var outText;
            if (mapId == 910340600) {
				var ii = cm.getItemInfo();
				var aa = ""+cm.getLevel()*98268+"";
                cm.setEventCount("废弃都市");
                outText = "通关成功!"+"您获得的组队任务奖品：\r\n#v2614046#x2 #v5062000#x2 #v5062002#x2 #v2431347#x2 #v2431114#x2 #v2436249#x2 \r\n抵用券x1200 PPMS活跃x1500 PPMS微积分x1500";
		        //cm.sendOk("您获得的组队任务奖品：\r\n#v2614046#x2 #v5062000#x2 #v5062002#x2 #v2431347#x2 #v2431114#x2 #v2436249#x2 \r\n抵用券x1200 PPMS活跃x1500 PPMS微积分x1500");					
                cm.warp(910340000, 0);
				cm.gainPlayerEnergy(1500);
				cm.gainPlayerPoints(1500);
				cm.gainItem(2614046, 2);
				cm.gainItem(5062002, 2);				
				cm.gainItem(5062000, 2);
				cm.gainItem(2431347, 2);
				cm.gainItem(2431114, 2);
				cm.gainItem(2436249, 2);				
				cm.gainNX(2, 1200);
	            cm.worldSpouseMessage(0x15, "『废都惊奇』 : " + cm.getChar().getName() + " 带着他的小分队突破了重重困难终于消灭了下水道的绿水灵王...");	

            } else {
                outText = "你确定要离开地图吗?";
            }
            if (status == 0) {
                cm.sendYesNo(outText);
            } else if (mode == 1) {
                cm.warp(910340000, "st00"); // Warp player
                cm.dispose();
            }
        }
    }
}

